<template>
  <div class="app-container">
    <Header v-show="isHeader"></Header>
    <main class="main-content">
      <router-view></router-view>
    </main>
  </div>
</template>

<script setup>
/**
 * 应用根组件
 */
import Header from "./components/Header.vue";

import { computed } from "vue";
import { useRoute } from "vue-router";

// 获取路由
const route = useRoute();
//使用计算属性实现复杂响应式数据
const isHeader = computed(() => {
  return (
    route.name !== "Login" &&
    route.name !== "Register" &&
    route.name !== "addNews"
  );
});
</script>

<style lang="less" scoped>
.app-container {
  min-height: 100vh;
  background-color: #f5f5f5;
}

.main-content {
  padding: 20px;
  min-height: calc(100vh - 60px);
}
</style>
